import 'package:flutter/material.dart';
import 'package:leader_help/global/user/logic.dart';
import 'package:leader_help/utils/component/dialog/drop.dart';
import 'package:leader_help/utils/component/dragable.dart';
import 'package:get/get.dart';
import 'package:leader_help/utils/util.dart';

import 'state.dart';

class TbController extends GetxController {
  final state = TabState();
  final userCtrl = Get.find<UserController>();
  void clickTab(int index) {
    if (state.currentIndex.value == index) {
      return;
    }
    state.currentIndex.value = index;
    // state.pageController.jumpToPage(index);
  }

  @override
  void onInit() {
    super.onInit();
  }

  @override
  void onReady() {
    super.onReady();

    // dragableEvent();
  }

  void dragableEvent() {
    ///提需求
    dragableItem(
      onTap: () {
        Get.toNamed(RouterPath.demand_submit);
      },
      size: 50.r,
      child: Container(
        width: 50.r,
        height: 50.r,
        decoration: BoxDecoration(
          color: ColorsUtil.red,
          borderRadius: BorderRadius.circular(25.r),
          boxShadow: [
            BoxShadow(
                color: ColorsUtil.red.withAlpha(80),
                offset: const Offset(1, 2)),
            BoxShadow(
                color: ColorsUtil.red.withAlpha(60),
                offset: const Offset(2, 3)),
          ],
        ),
        child: Icon(
          ProIconUtil.audio,
          color: Colors.white,
          size: 30.r,
        ),
      ),
    );

    dragableExpandItem(
      icon: Icons.more_horiz,
      activeIcon: Icons.more_vert,
      expandHeight: 60.r * 6,
      expandWidget: DragableListView(
        itemSize: 60.r,
        list: [
          UsuallyModel(
            name: '作指示',
            iconData: ProIconUtil.instruct,
            onTap: () {},
          ),
          UsuallyModel(
            name: '看现场',
            iconData: ProIconUtil.eye_green,
            onTap: () {},
          ),
          UsuallyModel(
            name: '面对面',
            iconData: ProIconUtil.online_chat,
            onTap: () {},
          ),
          UsuallyModel(
            name: '组建群',
            iconData: ProIconUtil.group,
            onTap: () {},
          ),
          UsuallyModel(
            name: '专题会',
            iconData: ProIconUtil.meet,
            onTap: () {},
          ),
          UsuallyModel(
            name: '云智库',
            iconData: ProIconUtil.phd,
            onTap: () {},
          ),
        ],
      ),
    );
  }
}
